#include "Group.h"

namespace kryptos { namespace entities {

Group::Group()
{
}

Group::~Group()
{
}

Group::Group(const std::string& name, GroupType type)
    : m_name(name)
    , m_type(type)
{
}

Group::Group(const std::string& name, GroupType type, ContactList members)
    : m_name(name)
    , m_type(type)
    , m_members(members)
{
}

void Group::addMember(const Contact& contact)
{
    m_members.push_back(contact);
}

bool Group::hasMember(const Contact& contact)
{
    bool isMember = false;
    foreach(const Contact& member, m_members)
    {
        if (member == contact)
        {
            isMember = true;
            break;
        }
    }

    return isMember;
}

std::string Group::name() const
{
    return m_name;
}

Group::GroupType Group::type() const
{
    return m_type;
}

ContactList Group::members() const
{
    return m_members;
}

}}
